package net.tv90.bfmccoreqqbot.util;


public class Assert {

    public static void assertNotNull(Class<? extends RuntimeException> throwable, String msg, Object object) {
        if (object == null) {
            try {
                throw throwable.getConstructor(String.class).newInstance(msg);
            } catch (Exception e) {
                throw new RuntimeException("Error creating exception instance", e);
            }
        }
    }

    public static void assertNotNull(String msg, Object object) {
        if (object == null) {
            throw new RuntimeException(msg);
        }
    }

    public static void assertNotNull(String msg, Object... objects) {
        for (Object object : objects) {
            if (object == null) {
                throw new RuntimeException(msg);
            }
        }
    }

    public static void assertNull(Class<? extends RuntimeException> throwable, String msg, Object object) {
        if (object != null) {
            try {
                throw throwable.getConstructor(String.class).newInstance(msg);
            } catch (Exception e) {
                throw new RuntimeException("Error creating exception instance", e);
            }
        }
    }

    public static void assertNull(String msg, Object object) {
        if (object != null) {
            throw new RuntimeException(msg);
        }
    }

    public static void assertNull(String msg, Object... objects) {
        for (Object object : objects) {
            if (object != null) {
                throw new RuntimeException(msg);
            }
        }
    }

}
